<?php
namespace Amis\dataviewer;

use Amis\Basics\AmisBasics;

class Color extends AmisBasics
{
    public string $type = 'color';

    public function className(string $className)
    {
        $this->className = $className;
        return $this;
    }

    /**
     * 显示的颜色值
     * @param string $value
     * @return $this
     */
    public function value(string $value)
    {
        $this->value = $value;
        return $this;
    }

    /**
     * 在其他组件中，时，用作变量映射
     * @param string $name
     * @return $this
     */
    public function name(string $name)
    {
        $this->name = $name;
        return $this;
    }

    /**
     * 默认颜色值
     * @param string $defaultColor
     * @return $this
     */
    public function defaultColor(string $defaultColor = '#ccc')
    {
        $this->defaultColor = $defaultColor;
        return $this;
    }

    /**
     * 是否显示右边的颜色值
     * @param bool $showValue
     * @return $this
     */
    public function showValue(bool $showValue = true)
    {
        $this->showValue = $showValue;
        return $this;
    }
}